<script setup>
import { ref } from 'vue'
import { artGetChannelService } from '@/api/article.js'

// 父传子 封装的组件
defineProps({
  modelValue: {
    // require: true,
    type: [Number, String]
  }
})
const emit = defineEmits(['update:modelValue'])
const channelList = ref([])
const getChannelList = async () => {
  const res = await artGetChannelService()
  channelList.value = res.data.data
  console.log(channelList.value)
}
getChannelList()

</script>

<template>
  <!--label展示给用户看的，value收集起来提交给后台的-->
  <el-select :modelValue="modelValue" @update:modelValue="emit('update:modelValue',$event)" style="width: 100%;min-width: 220px;">
    <el-option v-for="channel in channelList" :key="channel.id" :label="channel.cate_name" :value="channel.id"></el-option>
  </el-select>
</template>

<style lang="scss" scoped>
</style>
